/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufg.inf.si.poo.formula1.GUI;

import br.ufg.inf.si.poo.formula1.Circuit.Circuit;
import br.ufg.inf.si.poo.formula1.Driver.Driver;
import br.ufg.inf.si.poo.formula1.Interface.InterfaceRegister;
import br.ufg.inf.si.poo.formula1.Library.Library;
import br.ufg.inf.si.poo.formula1.Race.Race;
import br.ufg.inf.si.poo.formula1.Season.Season;
import br.ufg.inf.si.poo.formula1.Team.Team;
import java.text.ParseException;
import javax.swing.table.DefaultTableModel;

/**
 * FrameDefault
 *
 * Versao 1.0
 *
 * Data 16/02/2013
 *
 * @author Igor
 */
public class ReportSeason extends javax.swing.JInternalFrame implements InterfaceRegister {
    //Atributos

    Season season;
    Driver driver;
    Team team;
    Circuit circuit;
    Race race;

    /**
     * Creates new form FrameDefault
     */
    public ReportSeason() {
        initComponents();
        clearFields();
    }

    /**
     * Limpa labels que armazem valoers dos Objetos
     */
    private void clearLabelValues() {
        //Pilotos
        this.labelNomePiloto.setText("");
        this.labelEquipe1.setText("");
        this.labelNacionalidade1.setText("");
        this.labelPodiums1.setText("");
        this.labelPontos1.setText("");
        this.labelGrandPrix1.setText("");
        this.labelCampeaoMundial1.setText("");
        this.labelMelhorPosicaoCorrida1.setText("");
        this.labelMelhorPodiumCorrida1.setText("");
        this.labelDataNascimento1.setText("");
        this.labelLocalNascimento1.setText("");

        //Equipe
        this.labelNomeEquipe.setText("");
        this.labelNomeCompleto1.setText("");
        this.labelSede1.setText("");
        this.labelDiretor1.setText("");
        this.labelChefeTecnico1.setText("");
        this.labelPilotos1.setText("");
        this.labelPilotos2.setText("");
        this.labelPilotos3.setText("");
        this.labelPilotos4.setText("");
        this.labelChassis1.setText("");
        this.labelMotor1.setText("");
        this.labelPneus1.setText("");
        this.labelPrimeiraTemporada1.setText("");
        this.labelCampeonatosMundiais1.setText("");
        this.labelMelhorPosicaoCorridas1.setText("");
        this.labelPolePositions1.setText("");
        this.labelVoltasMaisRapidas1.setText("");
        this.labelPontosEquipe1.setText("");

        //Pilotos

        //Circuitos
        this.labelCidade.setText("");
        this.labelDataCorrida1.setText("");
        this.labelNomeCircuito1.setText("");
        this.labelPrimeiroGrandPrix1.setText("");
        this.labelNumeroVoltas1.setText("");
        this.labelDistanciaVolta1.setText("");
        this.labelTamanho1.setText("");
        this.labelVoltaRecord1.setText("");
    }

    /**
     * Exibe dados do piloto selecionado
     */
    private void dataShowDriver() {
        this.labelEquipe1.setText("");
        if (this.driver != null) {
            this.labelNomePiloto.setText(this.driver.getDriverName());
            if (this.driver.getTeam() != null) {
                this.labelEquipe1.setText(this.driver.getTeam().getShortName());
            }
            this.labelNacionalidade1.setText(this.driver.getNationality());
            this.labelPodiums1.setText("" + this.driver.getPodiums());
            this.labelPontos1.setText("" + this.driver.getPoints());
            this.labelGrandPrix1.setText("" + this.driver.getGrandPrixEntered());
            this.labelCampeaoMundial1.setText("" + this.driver.getWorldChampionships());
            this.labelMelhorPosicaoCorrida1.setText("" + this.driver.getHighestRaceFinish()[0]+" (x"+this.driver.getHighestRaceFinish()[1]+")");
            this.labelMelhorPodiumCorrida1.setText("" + this.driver.getHighestGridPosition()[0]+" (x"+this.driver.getHighestGridPosition()[1]+")");
            this.labelDataNascimento1.setText(this.driver.getDateBirth());
            this.labelLocalNascimento1.setText(this.driver.getPlaceBirth());

            this.driver = null;
        }
    }

    /**
     * Exibe dados da equipe selecionada
     */
    private void dataShowTeam() {
        if (this.team != null) {
            this.labelNomeEquipe.setText(this.team.getShortName());

            this.labelNomeCompleto1.setText(this.team.getFullName());
            this.labelSede1.setText(this.team.getBase());
            this.labelDiretor1.setText(this.team.getTeamPrincipal());
            this.labelChefeTecnico1.setText(this.team.getTechinicalChief());
            this.labelChassis1.setText(this.team.getChassis());
            this.labelMotor1.setText(this.team.getEngine());
            this.labelPneus1.setText(this.team.getTyres());
            this.labelPrimeiraTemporada1.setText("" + this.team.getFirstSeason());
            this.labelCampeonatosMundiais1.setText("" + this.team.getWorldChampionchips());
            this.labelMelhorPosicaoCorridas1.setText("" + this.team.getHighestRaceFinish()[0] + " (x" + this.team.getHighestRaceFinish()[1] + ")");
            this.labelPolePositions1.setText("" + this.team.getPolePositions());
            this.labelVoltasMaisRapidas1.setText("" + this.team.getFastesLaps());
            this.labelPontosEquipe1.setText("" + this.team.getPoints());


            this.labelPilotos1.setText("");
            this.labelPilotos2.setText("");
            this.labelPilotos3.setText("");
            this.labelPilotos4.setText("");
            for (int i = 0; i < 4; i++) {
                if (this.team.getDriver()[i] != null) {
                    String driverName = this.team.getDriver()[i].getDriverName();
                    switch (i) {
                        case 0:
                            this.labelPilotos1.setText(driverName);
                            break;
                        case 1:
                            this.labelPilotos2.setText(driverName);
                            break;
                        case 2:
                            this.labelPilotos3.setText(driverName);
                            break;
                        case 3:
                            this.labelPilotos4.setText(driverName);
                            break;
                    }
                }
            }

            this.team = null;
        }
    }

    /**
     * Exibe dados do circuito selecionado
     */
    private void dataShowCircuit() {
        if (this.circuit != null) {
            this.labelCidade.setText(this.circuit.getCity());
            this.labelDataCorrida1.setText(this.circuit.getRaceDate());
            this.labelNomeCircuito1.setText(this.circuit.getCircuitName());
            this.labelPrimeiroGrandPrix1.setText("" + this.circuit.getFirstGrandPrix());
            this.labelNumeroVoltas1.setText("" + this.circuit.getNumberLaps());
            this.labelDistanciaVolta1.setText("" + this.circuit.getCircuitLength());
            this.labelTamanho1.setText("" + this.circuit.getRaceDistance());
            this.labelVoltaRecord1.setText(Library.convertMilliseconds(this.circuit.getLapRecordTime(), "MINUTOS") + " - " + this.circuit.getLapRecordDriver());

            this.circuit = null;
        }
    }

    /**
     * Insere os dados do campeonato mundial de pilotos
     */
    private void insertLinesTableWorldChampionshipDrivers() {
        DefaultTableModel modelo = (DefaultTableModel) this.tableWorldChampionshipDrivers.getModel();
        while(modelo.getRowCount() > 0){
            modelo.removeRow(modelo.getRowCount()-1);
        }

        if (this.season != null) {
            Driver[] worldChampionship = this.season.getDriverWorldChampion();
            if (worldChampionship != null) {
                //Lista Pilotos Vinculados
                for (int i = 0; i < this.season.getQttDriver(); i++) {
                    Driver driver1 = worldChampionship[i];
                    if (driver1 != null) {
                        String Pos = "" + (i + 1);
                        String nationality = driver1.getNationality();
                        Team team = driver1.getTeam();
                        String points = "" + driver1.getPoints();

                        modelo.addRow(new String[]{"", ""});
                        int linha = modelo.getRowCount();
                        linha--;
                        modelo.setValueAt(Pos, linha, 0);
                        modelo.setValueAt(driver1.getDriverName(), linha, 1);
                        modelo.setValueAt(nationality, linha, 2);
                        modelo.setValueAt(team.getShortName(), linha, 3);
                        modelo.setValueAt(points, linha, 4);
                    }
                }
            }
        }
    }

    /**
     * Insere os dados do campeonato mundial de construtores
     */
    private void insertLinesTableWorldChampionshipBuilders() {
        DefaultTableModel modelo = (DefaultTableModel) this.tableWorldChampionshipBuilders.getModel();
        while(modelo.getRowCount() > 0){
            modelo.removeRow(modelo.getRowCount()-1);
        }

        if (this.season != null) {
            Team[] worldChampionship = this.season.getTeamWorldChampionshipBuilders();
            if (worldChampionship != null) {
                //Lista Pilotos Vinculados
                for (int i = 0; i < this.season.getQttTeams(); i++) {
                    Team team1 = worldChampionship[i];
                    if (team1 != null) {
                        String Pos = "" + (i + 1);
                        String points = "" + team1.getPoints();

                        modelo.addRow(new String[]{"", ""});
                        int linha = modelo.getRowCount();
                        linha--;
                        modelo.setValueAt(Pos, linha, 0);
                        modelo.setValueAt(team1.getShortName(), linha, 1);
                        modelo.setValueAt(points, linha, 2);
                    }
                }
            }
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelTitulo = new javax.swing.JPanel();
        labelTitulo = new javax.swing.JLabel();
        panelBotoes = new javax.swing.JPanel();
        buttonAtualizar = new javax.swing.JButton();
        labelCamposObrigatorios = new javax.swing.JLabel();
        pageControlRelatorios = new javax.swing.JTabbedPane();
        tabPanelPilotos = new javax.swing.JPanel();
        labelNomePiloto = new javax.swing.JLabel();
        labelEquipe = new javax.swing.JLabel();
        labelNacionalidade = new javax.swing.JLabel();
        labelPodiums = new javax.swing.JLabel();
        labelPontos = new javax.swing.JLabel();
        labelGrandPrix = new javax.swing.JLabel();
        labelCampeaoMundial = new javax.swing.JLabel();
        labelMelhorPosicaoCorrida = new javax.swing.JLabel();
        labelMelhorPodiumCorrida = new javax.swing.JLabel();
        labelDataNascimento = new javax.swing.JLabel();
        labelLocalNascimento = new javax.swing.JLabel();
        labelEquipe1 = new javax.swing.JLabel();
        labelNacionalidade1 = new javax.swing.JLabel();
        labelPodiums1 = new javax.swing.JLabel();
        labelPontos1 = new javax.swing.JLabel();
        labelGrandPrix1 = new javax.swing.JLabel();
        labelCampeaoMundial1 = new javax.swing.JLabel();
        labelMelhorPosicaoCorrida1 = new javax.swing.JLabel();
        labelMelhorPodiumCorrida1 = new javax.swing.JLabel();
        labelDataNascimento1 = new javax.swing.JLabel();
        labelLocalNascimento1 = new javax.swing.JLabel();
        panelPilotosCadastrados = new javax.swing.JPanel();
        jScrollPane5 = new javax.swing.JScrollPane();
        listPilotos = new javax.swing.JList();
        tabPanelEquipes = new javax.swing.JPanel();
        panelEquipesCadastradas = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        listEquipes = new javax.swing.JList();
        labelNomeEquipe = new javax.swing.JLabel();
        labelNomeCompleto = new javax.swing.JLabel();
        labelSede = new javax.swing.JLabel();
        labelDiretor = new javax.swing.JLabel();
        labelChefeTecnico = new javax.swing.JLabel();
        labelPilotos = new javax.swing.JLabel();
        labelPilotos1 = new javax.swing.JLabel();
        labelPilotos2 = new javax.swing.JLabel();
        labelPilotos3 = new javax.swing.JLabel();
        labelPilotos4 = new javax.swing.JLabel();
        labelChassis = new javax.swing.JLabel();
        labelMotor = new javax.swing.JLabel();
        labelPneus = new javax.swing.JLabel();
        labelPrimeiraTemporada = new javax.swing.JLabel();
        labelCampeonatosMundiais = new javax.swing.JLabel();
        labelMelhorPosicaoCorridas = new javax.swing.JLabel();
        labelPolePositions = new javax.swing.JLabel();
        labelVoltasMaisRapidas = new javax.swing.JLabel();
        labelPontosEquipe = new javax.swing.JLabel();
        labelNomeCompleto1 = new javax.swing.JLabel();
        labelSede1 = new javax.swing.JLabel();
        labelDiretor1 = new javax.swing.JLabel();
        labelChefeTecnico1 = new javax.swing.JLabel();
        labelChassis1 = new javax.swing.JLabel();
        labelMotor1 = new javax.swing.JLabel();
        labelPneus1 = new javax.swing.JLabel();
        labelPrimeiraTemporada1 = new javax.swing.JLabel();
        labelCampeonatosMundiais1 = new javax.swing.JLabel();
        labelMelhorPosicaoCorridas1 = new javax.swing.JLabel();
        labelPolePositions1 = new javax.swing.JLabel();
        labelVoltasMaisRapidas1 = new javax.swing.JLabel();
        labelPontosEquipe1 = new javax.swing.JLabel();
        tabPanelCircuitos = new javax.swing.JPanel();
        panelCircuitosCadastrados = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        listCircuitos = new javax.swing.JList();
        pageControlCorridas = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        labelCidade = new javax.swing.JLabel();
        labelDataCorrida = new javax.swing.JLabel();
        labelNomeCircuito = new javax.swing.JLabel();
        labelPrimeiroGrandPrix = new javax.swing.JLabel();
        labelNumeroVoltas = new javax.swing.JLabel();
        labelDistanciaVolta = new javax.swing.JLabel();
        labelTamanho = new javax.swing.JLabel();
        labelVoltaRecord = new javax.swing.JLabel();
        labelVoltaRecord1 = new javax.swing.JLabel();
        labelTamanho1 = new javax.swing.JLabel();
        labelDistanciaVolta1 = new javax.swing.JLabel();
        labelNumeroVoltas1 = new javax.swing.JLabel();
        labelPrimeiroGrandPrix1 = new javax.swing.JLabel();
        labelNomeCircuito1 = new javax.swing.JLabel();
        labelDataCorrida1 = new javax.swing.JLabel();
        tabPanelQualificacao = new javax.swing.JPanel();
        jScrollPane7 = new javax.swing.JScrollPane();
        tableQualification = new javax.swing.JTable();
        tabPanelCorrida = new javax.swing.JPanel();
        jScrollPane8 = new javax.swing.JScrollPane();
        tableRace = new javax.swing.JTable();
        tabPanelCampeonatoMundial = new javax.swing.JPanel();
        panelWorldChampionshipBuilders = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tableWorldChampionshipBuilders = new javax.swing.JTable();
        panelWorldChampionship = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        tableWorldChampionshipDrivers = new javax.swing.JTable();

        setClosable(true);
        setIconifiable(true);
        setTitle("Relatórios da Temporada");
        addComponentListener(new java.awt.event.ComponentAdapter() {
            public void componentShown(java.awt.event.ComponentEvent evt) {
                formComponentShown(evt);
            }
        });

        panelTitulo.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        labelTitulo.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        labelTitulo.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        labelTitulo.setText("Tela utilizada para visualização dos relatórios da temporada");

        javax.swing.GroupLayout panelTituloLayout = new javax.swing.GroupLayout(panelTitulo);
        panelTitulo.setLayout(panelTituloLayout);
        panelTituloLayout.setHorizontalGroup(
            panelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelTituloLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelTitulo)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panelTituloLayout.setVerticalGroup(
            panelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelTituloLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelTitulo)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        panelBotoes.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        buttonAtualizar.setText("Atualizar");
        buttonAtualizar.setToolTipText("");
        buttonAtualizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                buttonAtualizarActionPerformed(evt);
            }
        });

        labelCamposObrigatorios.setText("Campos marcados com *, são obrigatórios");

        javax.swing.GroupLayout panelBotoesLayout = new javax.swing.GroupLayout(panelBotoes);
        panelBotoes.setLayout(panelBotoesLayout);
        panelBotoesLayout.setHorizontalGroup(
            panelBotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelBotoesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelCamposObrigatorios)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(buttonAtualizar)
                .addContainerGap())
        );
        panelBotoesLayout.setVerticalGroup(
            panelBotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelBotoesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelBotoesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(buttonAtualizar)
                    .addComponent(labelCamposObrigatorios))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        labelNomePiloto.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        labelNomePiloto.setText("Nome");

        labelEquipe.setText("Equipe:");

        labelNacionalidade.setText("Nacionalidade:");
        labelNacionalidade.setToolTipText("");

        labelPodiums.setText("Podiums:");

        labelPontos.setText("Pontos:");

        labelGrandPrix.setText("Grand Prix:");

        labelCampeaoMundial.setText("Campeão Mundial:");

        labelMelhorPosicaoCorrida.setText("Melhor posição em corrida:");

        labelMelhorPodiumCorrida.setText("Melhor podium em corrida:");

        labelDataNascimento.setText("Data de Nascimento:");

        labelLocalNascimento.setText("Local de Nascimento:");

        labelEquipe1.setText("Valores");

        labelNacionalidade1.setText("Valores");
        labelNacionalidade1.setToolTipText("");

        labelPodiums1.setText("Valores");

        labelPontos1.setText("Valores");

        labelGrandPrix1.setText("Valores");

        labelCampeaoMundial1.setText("Valores");

        labelMelhorPosicaoCorrida1.setText("Valores");

        labelMelhorPodiumCorrida1.setText("Valores");

        labelDataNascimento1.setText("Valores");

        labelLocalNascimento1.setText("Valores");

        panelPilotosCadastrados.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "   Pilotos   ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 10), java.awt.Color.black)); // NOI18N

        listPilotos.setToolTipText("Lista de pilotos cadastrados");
        listPilotos.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                listPilotosValueChanged(evt);
            }
        });
        jScrollPane5.setViewportView(listPilotos);

        javax.swing.GroupLayout panelPilotosCadastradosLayout = new javax.swing.GroupLayout(panelPilotosCadastrados);
        panelPilotosCadastrados.setLayout(panelPilotosCadastradosLayout);
        panelPilotosCadastradosLayout.setHorizontalGroup(
            panelPilotosCadastradosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane5, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
        );
        panelPilotosCadastradosLayout.setVerticalGroup(
            panelPilotosCadastradosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane5)
        );

        javax.swing.GroupLayout tabPanelPilotosLayout = new javax.swing.GroupLayout(tabPanelPilotos);
        tabPanelPilotos.setLayout(tabPanelPilotosLayout);
        tabPanelPilotosLayout.setHorizontalGroup(
            tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabPanelPilotosLayout.createSequentialGroup()
                .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(tabPanelPilotosLayout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(labelNomePiloto))
                    .addGroup(tabPanelPilotosLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelEquipe)
                            .addComponent(labelNacionalidade)
                            .addComponent(labelPodiums)
                            .addComponent(labelPontos)
                            .addComponent(labelGrandPrix)
                            .addComponent(labelCampeaoMundial)
                            .addComponent(labelMelhorPosicaoCorrida)
                            .addComponent(labelMelhorPodiumCorrida)
                            .addComponent(labelDataNascimento)
                            .addComponent(labelLocalNascimento))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelLocalNascimento1)
                            .addComponent(labelMelhorPosicaoCorrida1)
                            .addComponent(labelDataNascimento1)
                            .addComponent(labelPodiums1)
                            .addComponent(labelMelhorPodiumCorrida1)
                            .addComponent(labelPontos1)
                            .addComponent(labelCampeaoMundial1)
                            .addComponent(labelNacionalidade1)
                            .addComponent(labelEquipe1)
                            .addComponent(labelGrandPrix1))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 525, Short.MAX_VALUE)
                .addComponent(panelPilotosCadastrados, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        tabPanelPilotosLayout.setVerticalGroup(
            tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabPanelPilotosLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelNomePiloto)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelEquipe)
                    .addComponent(labelEquipe1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelNacionalidade)
                    .addComponent(labelNacionalidade1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelPodiums)
                    .addComponent(labelPodiums1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelPontos)
                    .addComponent(labelPontos1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelGrandPrix1)
                    .addComponent(labelGrandPrix))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelCampeaoMundial)
                    .addComponent(labelCampeaoMundial1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelMelhorPosicaoCorrida)
                    .addComponent(labelMelhorPosicaoCorrida1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelMelhorPodiumCorrida)
                    .addComponent(labelMelhorPodiumCorrida1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelDataNascimento)
                    .addComponent(labelDataNascimento1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelPilotosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelLocalNascimento)
                    .addComponent(labelLocalNascimento1))
                .addContainerGap(234, Short.MAX_VALUE))
            .addComponent(panelPilotosCadastrados, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pageControlRelatorios.addTab("Pilotos", tabPanelPilotos);

        panelEquipesCadastradas.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "   Equipes   ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 10), java.awt.Color.black)); // NOI18N
        panelEquipesCadastradas.setPreferredSize(new java.awt.Dimension(232, 152));

        listEquipes.setToolTipText("Lista de equipes cadastradas");
        listEquipes.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                listEquipesValueChanged(evt);
            }
        });
        jScrollPane3.setViewportView(listEquipes);

        javax.swing.GroupLayout panelEquipesCadastradasLayout = new javax.swing.GroupLayout(panelEquipesCadastradas);
        panelEquipesCadastradas.setLayout(panelEquipesCadastradasLayout);
        panelEquipesCadastradasLayout.setHorizontalGroup(
            panelEquipesCadastradasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
        );
        panelEquipesCadastradasLayout.setVerticalGroup(
            panelEquipesCadastradasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE)
        );

        labelNomeEquipe.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        labelNomeEquipe.setText("Nome");

        labelNomeCompleto.setText("Nome Completo:");

        labelSede.setText("Sede:");

        labelDiretor.setText("Diretor:");

        labelChefeTecnico.setText("Chefe Técnico:");

        labelPilotos.setText("Pilotos:");

        labelPilotos1.setText("Valores");

        labelPilotos2.setText("Valores");

        labelPilotos3.setText("Valores");

        labelPilotos4.setText("Valores");

        labelChassis.setText("Chassis:");

        labelMotor.setText("Motor:");

        labelPneus.setText("Pneus:");

        labelPrimeiraTemporada.setText("Primeira Temporada:");

        labelCampeonatosMundiais.setText("Campeonatos mundiais:");
        labelCampeonatosMundiais.setToolTipText("");

        labelMelhorPosicaoCorridas.setText("Melhor posição em corridas:");

        labelPolePositions.setText("Pole positions:");

        labelVoltasMaisRapidas.setText("Voltas mais rápidas:");

        labelPontosEquipe.setText("Pontos:");

        labelNomeCompleto1.setText("Valores");

        labelSede1.setText("Valores");

        labelDiretor1.setText("Valores");

        labelChefeTecnico1.setText("Valores");

        labelChassis1.setText("Valores");

        labelMotor1.setText("Valores");

        labelPneus1.setText("Valores");

        labelPrimeiraTemporada1.setText("Valores");

        labelCampeonatosMundiais1.setText("Valores");
        labelCampeonatosMundiais1.setToolTipText("");

        labelMelhorPosicaoCorridas1.setText("Valores");

        labelPolePositions1.setText("Valores");

        labelVoltasMaisRapidas1.setText("Valores");

        labelPontosEquipe1.setText("Valores");

        javax.swing.GroupLayout tabPanelEquipesLayout = new javax.swing.GroupLayout(tabPanelEquipes);
        tabPanelEquipes.setLayout(tabPanelEquipesLayout);
        tabPanelEquipesLayout.setHorizontalGroup(
            tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabPanelEquipesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelNomeEquipe)
                    .addComponent(labelNomeCompleto)
                    .addComponent(labelSede)
                    .addComponent(labelDiretor)
                    .addComponent(labelChefeTecnico)
                    .addComponent(labelPilotos)
                    .addComponent(labelChassis)
                    .addComponent(labelMotor)
                    .addComponent(labelPneus)
                    .addComponent(labelPrimeiraTemporada)
                    .addComponent(labelCampeonatosMundiais)
                    .addComponent(labelMelhorPosicaoCorridas)
                    .addComponent(labelPolePositions)
                    .addComponent(labelVoltasMaisRapidas)
                    .addComponent(labelPontosEquipe))
                .addGap(6, 6, 6)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelNomeCompleto1)
                    .addComponent(labelSede1)
                    .addComponent(labelDiretor1)
                    .addComponent(labelChefeTecnico1)
                    .addComponent(labelPilotos1)
                    .addComponent(labelPilotos2)
                    .addComponent(labelPilotos3)
                    .addComponent(labelPilotos4)
                    .addComponent(labelChassis1)
                    .addComponent(labelMotor1)
                    .addComponent(labelPneus1)
                    .addComponent(labelPrimeiraTemporada1)
                    .addComponent(labelCampeonatosMundiais1)
                    .addComponent(labelMelhorPosicaoCorridas1)
                    .addComponent(labelPolePositions1)
                    .addComponent(labelVoltasMaisRapidas1)
                    .addComponent(labelPontosEquipe1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 520, Short.MAX_VALUE)
                .addComponent(panelEquipesCadastradas, javax.swing.GroupLayout.PREFERRED_SIZE, 250, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        tabPanelEquipesLayout.setVerticalGroup(
            tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabPanelEquipesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelNomeEquipe)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelNomeCompleto)
                    .addComponent(labelNomeCompleto1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelSede)
                    .addComponent(labelSede1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelDiretor)
                    .addComponent(labelDiretor1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelChefeTecnico)
                    .addComponent(labelChefeTecnico1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelPilotos)
                    .addComponent(labelPilotos1))
                .addGap(6, 6, 6)
                .addComponent(labelPilotos2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelPilotos3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelPilotos4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelChassis)
                    .addComponent(labelChassis1))
                .addGap(6, 6, 6)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelMotor)
                    .addComponent(labelMotor1))
                .addGap(6, 6, 6)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelPneus)
                    .addComponent(labelPneus1))
                .addGap(6, 6, 6)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelPrimeiraTemporada)
                    .addComponent(labelPrimeiraTemporada1))
                .addGap(6, 6, 6)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelCampeonatosMundiais)
                    .addComponent(labelCampeonatosMundiais1))
                .addGap(6, 6, 6)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelMelhorPosicaoCorridas)
                    .addComponent(labelMelhorPosicaoCorridas1))
                .addGap(6, 6, 6)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelPolePositions)
                    .addComponent(labelPolePositions1))
                .addGap(6, 6, 6)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelVoltasMaisRapidas)
                    .addComponent(labelVoltasMaisRapidas1))
                .addGap(6, 6, 6)
                .addGroup(tabPanelEquipesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelPontosEquipe)
                    .addComponent(labelPontosEquipe1))
                .addContainerGap())
            .addComponent(panelEquipesCadastradas, javax.swing.GroupLayout.DEFAULT_SIZE, 474, Short.MAX_VALUE)
        );

        pageControlRelatorios.addTab("Equipes", tabPanelEquipes);

        panelCircuitosCadastrados.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "   Circuitos   ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 10), java.awt.Color.black)); // NOI18N

        listCircuitos.setToolTipText("Lista de circuitos cadastrados");
        listCircuitos.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
            public void valueChanged(javax.swing.event.ListSelectionEvent evt) {
                listCircuitosValueChanged(evt);
            }
        });
        jScrollPane4.setViewportView(listCircuitos);

        javax.swing.GroupLayout panelCircuitosCadastradosLayout = new javax.swing.GroupLayout(panelCircuitosCadastrados);
        panelCircuitosCadastrados.setLayout(panelCircuitosCadastradosLayout);
        panelCircuitosCadastradosLayout.setHorizontalGroup(
            panelCircuitosCadastradosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane4, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
        );
        panelCircuitosCadastradosLayout.setVerticalGroup(
            panelCircuitosCadastradosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane4)
        );

        labelCidade.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N
        labelCidade.setText("Nome");

        labelDataCorrida.setText("Data da Corrida:");

        labelNomeCircuito.setText("Nome do Circuito");

        labelPrimeiroGrandPrix.setText("Primeiro Grand Prix:");

        labelNumeroVoltas.setText("Número de Voltas:");

        labelDistanciaVolta.setText("Distância da Volta (KM):");

        labelTamanho.setText("Tamanho (KM):");

        labelVoltaRecord.setText("Volta recorde:");

        labelVoltaRecord1.setText("Valores");

        labelTamanho1.setText("Valores");

        labelDistanciaVolta1.setText("Valores");

        labelNumeroVoltas1.setText("Valores");

        labelPrimeiroGrandPrix1.setText("Valores");

        labelNomeCircuito1.setText("Valores");

        labelDataCorrida1.setText("Valores");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelDataCorrida)
                            .addComponent(labelNomeCircuito)
                            .addComponent(labelPrimeiroGrandPrix)
                            .addComponent(labelNumeroVoltas)
                            .addComponent(labelDistanciaVolta)
                            .addComponent(labelTamanho)
                            .addComponent(labelVoltaRecord))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelPrimeiroGrandPrix1)
                            .addComponent(labelNomeCircuito1)
                            .addComponent(labelNumeroVoltas1)
                            .addComponent(labelTamanho1)
                            .addComponent(labelDistanciaVolta1)
                            .addComponent(labelVoltaRecord1)
                            .addComponent(labelDataCorrida1)))
                    .addComponent(labelCidade))
                .addContainerGap(518, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(labelCidade)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelDataCorrida)
                    .addComponent(labelDataCorrida1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelNomeCircuito)
                    .addComponent(labelNomeCircuito1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelPrimeiroGrandPrix)
                    .addComponent(labelPrimeiroGrandPrix1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelNumeroVoltas)
                    .addComponent(labelNumeroVoltas1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelDistanciaVolta)
                    .addComponent(labelDistanciaVolta1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelTamanho)
                    .addComponent(labelTamanho1))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                    .addComponent(labelVoltaRecord)
                    .addComponent(labelVoltaRecord1))
                .addContainerGap(266, Short.MAX_VALUE))
        );

        pageControlCorridas.addTab("Circuitos", null, jPanel2, "");

        tableQualification.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Pos", "No", "Driver", "Team", "Q1", "Q2", "Q3", "Laps"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tableQualification.getTableHeader().setReorderingAllowed(false);
        jScrollPane7.setViewportView(tableQualification);
        tableQualification.getColumnModel().getColumn(0).setResizable(false);
        tableQualification.getColumnModel().getColumn(1).setResizable(false);
        tableQualification.getColumnModel().getColumn(2).setResizable(false);
        tableQualification.getColumnModel().getColumn(3).setResizable(false);
        tableQualification.getColumnModel().getColumn(4).setResizable(false);
        tableQualification.getColumnModel().getColumn(5).setResizable(false);
        tableQualification.getColumnModel().getColumn(6).setResizable(false);
        tableQualification.getColumnModel().getColumn(7).setResizable(false);

        javax.swing.GroupLayout tabPanelQualificacaoLayout = new javax.swing.GroupLayout(tabPanelQualificacao);
        tabPanelQualificacao.setLayout(tabPanelQualificacaoLayout);
        tabPanelQualificacaoLayout.setHorizontalGroup(
            tabPanelQualificacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 683, Short.MAX_VALUE)
        );
        tabPanelQualificacaoLayout.setVerticalGroup(
            tabPanelQualificacaoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane7, javax.swing.GroupLayout.DEFAULT_SIZE, 446, Short.MAX_VALUE)
        );

        pageControlCorridas.addTab("Qualificação", tabPanelQualificacao);

        tableRace.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Pos", "No", "Driver", "Team", "Laps", "Time/Retired", "Grid", "Pts"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.Integer.class, java.lang.Integer.class, java.lang.String.class, java.lang.String.class, java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class, java.lang.Integer.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tableRace.getTableHeader().setReorderingAllowed(false);
        jScrollPane8.setViewportView(tableRace);
        tableRace.getColumnModel().getColumn(0).setResizable(false);
        tableRace.getColumnModel().getColumn(1).setResizable(false);
        tableRace.getColumnModel().getColumn(2).setResizable(false);
        tableRace.getColumnModel().getColumn(3).setResizable(false);
        tableRace.getColumnModel().getColumn(4).setResizable(false);
        tableRace.getColumnModel().getColumn(5).setResizable(false);
        tableRace.getColumnModel().getColumn(6).setResizable(false);
        tableRace.getColumnModel().getColumn(7).setResizable(false);

        javax.swing.GroupLayout tabPanelCorridaLayout = new javax.swing.GroupLayout(tabPanelCorrida);
        tabPanelCorrida.setLayout(tabPanelCorridaLayout);
        tabPanelCorridaLayout.setHorizontalGroup(
            tabPanelCorridaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 683, Short.MAX_VALUE)
        );
        tabPanelCorridaLayout.setVerticalGroup(
            tabPanelCorridaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane8, javax.swing.GroupLayout.DEFAULT_SIZE, 446, Short.MAX_VALUE)
        );

        pageControlCorridas.addTab("Corrida", tabPanelCorrida);

        javax.swing.GroupLayout tabPanelCircuitosLayout = new javax.swing.GroupLayout(tabPanelCircuitos);
        tabPanelCircuitos.setLayout(tabPanelCircuitosLayout);
        tabPanelCircuitosLayout.setHorizontalGroup(
            tabPanelCircuitosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabPanelCircuitosLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(pageControlCorridas)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelCircuitosCadastrados, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        tabPanelCircuitosLayout.setVerticalGroup(
            tabPanelCircuitosLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelCircuitosCadastrados, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(pageControlCorridas)
        );

        pageControlRelatorios.addTab("Circuitos", tabPanelCircuitos);

        panelWorldChampionshipBuilders.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "   Construtores (Equipes)   ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 10), java.awt.Color.black)); // NOI18N

        tableWorldChampionshipBuilders.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Pos", "Team", "Points"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tableWorldChampionshipBuilders.getTableHeader().setReorderingAllowed(false);
        jScrollPane2.setViewportView(tableWorldChampionshipBuilders);
        tableWorldChampionshipBuilders.getColumnModel().getColumn(0).setResizable(false);
        tableWorldChampionshipBuilders.getColumnModel().getColumn(0).setPreferredWidth(50);
        tableWorldChampionshipBuilders.getColumnModel().getColumn(1).setResizable(false);
        tableWorldChampionshipBuilders.getColumnModel().getColumn(1).setPreferredWidth(200);
        tableWorldChampionshipBuilders.getColumnModel().getColumn(2).setResizable(false);
        tableWorldChampionshipBuilders.getColumnModel().getColumn(2).setPreferredWidth(50);

        javax.swing.GroupLayout panelWorldChampionshipBuildersLayout = new javax.swing.GroupLayout(panelWorldChampionshipBuilders);
        panelWorldChampionshipBuilders.setLayout(panelWorldChampionshipBuildersLayout);
        panelWorldChampionshipBuildersLayout.setHorizontalGroup(
            panelWorldChampionshipBuildersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 472, Short.MAX_VALUE)
        );
        panelWorldChampionshipBuildersLayout.setVerticalGroup(
            panelWorldChampionshipBuildersLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2)
        );

        panelWorldChampionship.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "   Pilotos   ", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 10), new java.awt.Color(0, 0, 0))); // NOI18N

        tableWorldChampionshipDrivers.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Pos", "Driver", "Nationality", "Team", "Points"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class, java.lang.String.class
            };
            boolean[] canEdit = new boolean [] {
                false, false, false, false, false
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        tableWorldChampionshipDrivers.getTableHeader().setReorderingAllowed(false);
        jScrollPane1.setViewportView(tableWorldChampionshipDrivers);
        tableWorldChampionshipDrivers.getColumnModel().getColumn(0).setResizable(false);
        tableWorldChampionshipDrivers.getColumnModel().getColumn(1).setResizable(false);
        tableWorldChampionshipDrivers.getColumnModel().getColumn(1).setPreferredWidth(200);
        tableWorldChampionshipDrivers.getColumnModel().getColumn(2).setResizable(false);
        tableWorldChampionshipDrivers.getColumnModel().getColumn(2).setPreferredWidth(200);
        tableWorldChampionshipDrivers.getColumnModel().getColumn(3).setResizable(false);
        tableWorldChampionshipDrivers.getColumnModel().getColumn(3).setPreferredWidth(200);
        tableWorldChampionshipDrivers.getColumnModel().getColumn(4).setResizable(false);

        javax.swing.GroupLayout panelWorldChampionshipLayout = new javax.swing.GroupLayout(panelWorldChampionship);
        panelWorldChampionship.setLayout(panelWorldChampionshipLayout);
        panelWorldChampionshipLayout.setHorizontalGroup(
            panelWorldChampionshipLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        panelWorldChampionshipLayout.setVerticalGroup(
            panelWorldChampionshipLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 452, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout tabPanelCampeonatoMundialLayout = new javax.swing.GroupLayout(tabPanelCampeonatoMundial);
        tabPanelCampeonatoMundial.setLayout(tabPanelCampeonatoMundialLayout);
        tabPanelCampeonatoMundialLayout.setHorizontalGroup(
            tabPanelCampeonatoMundialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(tabPanelCampeonatoMundialLayout.createSequentialGroup()
                .addComponent(panelWorldChampionship, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelWorldChampionshipBuilders, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        tabPanelCampeonatoMundialLayout.setVerticalGroup(
            tabPanelCampeonatoMundialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(panelWorldChampionship, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(panelWorldChampionshipBuilders, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        pageControlRelatorios.addTab("Campeonato Mundial", tabPanelCampeonatoMundial);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(panelTitulo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(panelBotoes, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pageControlRelatorios, javax.swing.GroupLayout.Alignment.LEADING))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pageControlRelatorios)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelBotoes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        pageControlRelatorios.getAccessibleContext().setAccessibleName("");

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void buttonAtualizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_buttonAtualizarActionPerformed
        // TODO add your handling code here:
        clearFields();
    }//GEN-LAST:event_buttonAtualizarActionPerformed

    private void listEquipesValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listEquipesValueChanged
        // TODO add your handling code here:
        if (this.listEquipes.getSelectedIndex() != -1) {
            Team team1 = Library.returnTeam((String) this.listEquipes.getSelectedValue());
            if (team1 != null) {
                this.team = team1;
            }
        }
        dataShowObject();
    }//GEN-LAST:event_listEquipesValueChanged

    private void listCircuitosValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listCircuitosValueChanged
        // TODO add your handling code here:
        if (this.listCircuitos.getSelectedIndex() != -1) {
            Circuit circuit1 = Library.returnCircuit((String) this.listCircuitos.getSelectedValue());
            if (circuit1 != null) {
                this.circuit = circuit1;
                this.race = Library.returnRace(this.circuit.getCountry());
            }
        }
        dataShowObject();
    }//GEN-LAST:event_listCircuitosValueChanged

    private void formComponentShown(java.awt.event.ComponentEvent evt) {//GEN-FIRST:event_formComponentShown
        // TODO add your handling code here:
        clearFields();
    }//GEN-LAST:event_formComponentShown

    private void listPilotosValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_listPilotosValueChanged
        // TODO add your handling code here:
        if (this.listPilotos.getSelectedIndex() != -1) {
            Driver driver1 = Library.returnDriver((String) this.listPilotos.getSelectedValue());
            if (driver1 != null) {
                this.driver = driver1;
            }
        }
        dataShowObject();
    }//GEN-LAST:event_listPilotosValueChanged

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton buttonAtualizar;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JScrollPane jScrollPane7;
    private javax.swing.JScrollPane jScrollPane8;
    private javax.swing.JLabel labelCampeaoMundial;
    private javax.swing.JLabel labelCampeaoMundial1;
    private javax.swing.JLabel labelCampeonatosMundiais;
    private javax.swing.JLabel labelCampeonatosMundiais1;
    private javax.swing.JLabel labelCamposObrigatorios;
    private javax.swing.JLabel labelChassis;
    private javax.swing.JLabel labelChassis1;
    private javax.swing.JLabel labelChefeTecnico;
    private javax.swing.JLabel labelChefeTecnico1;
    private javax.swing.JLabel labelCidade;
    private javax.swing.JLabel labelDataCorrida;
    private javax.swing.JLabel labelDataCorrida1;
    private javax.swing.JLabel labelDataNascimento;
    private javax.swing.JLabel labelDataNascimento1;
    private javax.swing.JLabel labelDiretor;
    private javax.swing.JLabel labelDiretor1;
    private javax.swing.JLabel labelDistanciaVolta;
    private javax.swing.JLabel labelDistanciaVolta1;
    private javax.swing.JLabel labelEquipe;
    private javax.swing.JLabel labelEquipe1;
    private javax.swing.JLabel labelGrandPrix;
    private javax.swing.JLabel labelGrandPrix1;
    private javax.swing.JLabel labelLocalNascimento;
    private javax.swing.JLabel labelLocalNascimento1;
    private javax.swing.JLabel labelMelhorPodiumCorrida;
    private javax.swing.JLabel labelMelhorPodiumCorrida1;
    private javax.swing.JLabel labelMelhorPosicaoCorrida;
    private javax.swing.JLabel labelMelhorPosicaoCorrida1;
    private javax.swing.JLabel labelMelhorPosicaoCorridas;
    private javax.swing.JLabel labelMelhorPosicaoCorridas1;
    private javax.swing.JLabel labelMotor;
    private javax.swing.JLabel labelMotor1;
    private javax.swing.JLabel labelNacionalidade;
    private javax.swing.JLabel labelNacionalidade1;
    private javax.swing.JLabel labelNomeCircuito;
    private javax.swing.JLabel labelNomeCircuito1;
    private javax.swing.JLabel labelNomeCompleto;
    private javax.swing.JLabel labelNomeCompleto1;
    private javax.swing.JLabel labelNomeEquipe;
    private javax.swing.JLabel labelNomePiloto;
    private javax.swing.JLabel labelNumeroVoltas;
    private javax.swing.JLabel labelNumeroVoltas1;
    private javax.swing.JLabel labelPilotos;
    private javax.swing.JLabel labelPilotos1;
    private javax.swing.JLabel labelPilotos2;
    private javax.swing.JLabel labelPilotos3;
    private javax.swing.JLabel labelPilotos4;
    private javax.swing.JLabel labelPneus;
    private javax.swing.JLabel labelPneus1;
    private javax.swing.JLabel labelPodiums;
    private javax.swing.JLabel labelPodiums1;
    private javax.swing.JLabel labelPolePositions;
    private javax.swing.JLabel labelPolePositions1;
    private javax.swing.JLabel labelPontos;
    private javax.swing.JLabel labelPontos1;
    private javax.swing.JLabel labelPontosEquipe;
    private javax.swing.JLabel labelPontosEquipe1;
    private javax.swing.JLabel labelPrimeiraTemporada;
    private javax.swing.JLabel labelPrimeiraTemporada1;
    private javax.swing.JLabel labelPrimeiroGrandPrix;
    private javax.swing.JLabel labelPrimeiroGrandPrix1;
    private javax.swing.JLabel labelSede;
    private javax.swing.JLabel labelSede1;
    private javax.swing.JLabel labelTamanho;
    private javax.swing.JLabel labelTamanho1;
    private javax.swing.JLabel labelTitulo;
    private javax.swing.JLabel labelVoltaRecord;
    private javax.swing.JLabel labelVoltaRecord1;
    private javax.swing.JLabel labelVoltasMaisRapidas;
    private javax.swing.JLabel labelVoltasMaisRapidas1;
    private javax.swing.JList listCircuitos;
    private javax.swing.JList listEquipes;
    private javax.swing.JList listPilotos;
    private javax.swing.JTabbedPane pageControlCorridas;
    private javax.swing.JTabbedPane pageControlRelatorios;
    private javax.swing.JPanel panelBotoes;
    private javax.swing.JPanel panelCircuitosCadastrados;
    private javax.swing.JPanel panelEquipesCadastradas;
    private javax.swing.JPanel panelPilotosCadastrados;
    private javax.swing.JPanel panelTitulo;
    private javax.swing.JPanel panelWorldChampionship;
    private javax.swing.JPanel panelWorldChampionshipBuilders;
    private javax.swing.JPanel tabPanelCampeonatoMundial;
    private javax.swing.JPanel tabPanelCircuitos;
    private javax.swing.JPanel tabPanelCorrida;
    private javax.swing.JPanel tabPanelEquipes;
    private javax.swing.JPanel tabPanelPilotos;
    private javax.swing.JPanel tabPanelQualificacao;
    private javax.swing.JTable tableQualification;
    private javax.swing.JTable tableRace;
    private javax.swing.JTable tableWorldChampionshipBuilders;
    private javax.swing.JTable tableWorldChampionshipDrivers;
    // End of variables declaration//GEN-END:variables

    @Override
    public void dataShowObject() {
        this.season = FrameMain.getSeasonLoaded();

        Library.indexedListDrivers(this.listPilotos, null, FrameMain.getSeasonLoaded(), false);
        Library.indexedListTeams(this.listEquipes, null, FrameMain.getSeasonLoaded());
        Library.indexedListCircuits(this.listCircuitos, null, FrameMain.getSeasonLoaded());

        dataShowDriver();
        dataShowTeam();
        dataShowCircuit();
        Library.insertLinesTableQualification(this.tableQualification, this.race);
        Library.insertLinesTableRace(this.tableRace, this.race);

        insertLinesTableWorldChampionshipDrivers();
        insertLinesTableWorldChampionshipBuilders();
    }

    @Override
    public void checkFields() throws IllegalArgumentException {
        //Implementar se necessario
    }

    @Override
    public void checkValueEntered() throws IllegalArgumentException, ParseException {
        //Implementar se necessario
    }

    @Override
    public void createObject() throws IllegalArgumentException {
        //Implementar se necessario
    }

    @Override
    public void clearFields() {
        this.season = null;
        this.driver = null;
        this.team = null;
        this.circuit = null;
        this.race = null;

        clearLabelValues();

        //Seleciona os primeiros registros das JList
        this.listPilotos.setSelectedIndex(0);
        this.listEquipes.setSelectedIndex(0);
        this.listCircuitos.setSelectedIndex(0);

        dataShowObject();

        this.labelTitulo.setText("Tela utilizada para visualização dos relatórios da temporada " + FrameMain.getSeasonLoaded().getYear());
    }
}
